<cfparam default="" name="PageType" />

<cfset Providers = BASE.SCF_Exchange_GetEmployeesInDL("CN=SCF Elders Program,OU=Dynamic Groups,OU=SCFUsers,DC=SouthcentralFoundation,DC=com")/>
<cfset prov_list = "" />
<cfloop from="1" to="#ArrayLen(Providers)#" index="i" >
<cfset prov_list &= "#Providers[i].RosettaID#," />
</cfloop>

<cfoutput>
	<!---HTML header, css links, js links, and page title--->
    #BASE.htmlHeader("", "", "Elder's Program - Reports")#
    <!---HTML header, css links, js links, and page title--->
        
        <!---QUERIES.providerDistribution is set in showreport--->	       
        
        <cfif PageType EQ "PDF" >
            
            <cfdocument format="pdf"> 
      
                <h2>Provider Distribution</h2>
                
                <table border="1" cellpadding="1" cellspacing="0">
                    <thead>
                        <tr>
                            <th>ProviderName</th><th>Priority Name</th><th>Elder Count</th>
                        </tr>
                    </thead>
                    <tbody>
                        <cfloop query="QUERIES.providerDistribution">
                        <tr>
                            <cfif ListFind( prov_list, QUERIES.providerDistribution.ProviderID) NEQ 0 >
	                            <td>#BASE.SCF_EMPLOYEE_GetEmployee( QUERIES.providerDistribution.ProviderID ).FullName#</td>
	                        <cfelse>
	                            <td>[Not Found]</td>
	                        </cfif>
                            <td>#QUERIES.providerDistribution.PriorityName#</td>
                            <td align="center">#QUERIES.providerDistribution.Count#</td>
                            
                        </tr>
                        </cfloop>
                    </tbody>    
                </table> 
            </cfdocument>  
            
        <cfelse>   
            <h2>Provider Distribution</h2>
         
            <table border="1" cellpadding="1" cellspacing="0">
                <thead>
                    <tr>
                        <th>ProviderName</th><th>Priority Name</th><th>Elder Count</th>
                    </tr>
                </thead>
                <tbody>
                    <cfloop query="QUERIES.providerDistribution">
                    <tr>
                        <cfif ListFind( prov_list, QUERIES.providerDistribution.ProviderID) NEQ 0 >
                            <td>#BASE.SCF_EMPLOYEE_GetEmployee( QUERIES.providerDistribution.ProviderID ).FullName#</td>
                        <cfelse>
                            <td>[Not Found]</td>
                        </cfif>
                        <td>#QUERIES.providerDistribution.PriorityName#</td>
                        <td align="center">#QUERIES.providerDistribution.Count#</td>
                        
                    </tr>
                    </cfloop>
                </tbody>           
            </table>
            
        </cfif>
        
    <!---HTML footer, closes html and body tags.  Any footer info goes here--->
    #BASE.htmlFooter()#
    <!---HTML footer, closes html and body tags.  Any footer info goes here--->
</cfoutput>